package com.pain.scaffold.admin.backend.controller;

import com.pain.scaffold.admin.backend.domain.User;
import com.pain.scaffold.common.model.core.R;
import com.pain.scaffold.admin.backend.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(tags = "测试swagger")
public class UserController {

    @Resource
    IUserService userService;

    @GetMapping("{id}")
    @ApiOperation("测试接口")
    @ApiImplicitParam(name = "name",value = "姓名",required = true)
    public R getUser(@PathVariable("id") Integer id){
        User byId = userService.getById(id);
        return R.ok(byId);
    }

}
